import service from '@/utils/crmRequest'

export default () => ({

  // 商业流向---导入创建
  TBUSINESSFLOW_CRRATED: (data) => {
    return service({
      url: '/api/businessFlow/create',
      method: 'post',
      data
    })
  },

  // 商业流向---配送商搜索
  TBUSINESSFLOW_DISTRIBUTION: (name) => {
    return service({
      url: `/api/businessFlow/distribute/down/list?name=${name}`,
      method: 'get',
    })
  },

  // 商业流向---代理商搜索
  TBUSINESSFLOW_AGENT: (name) => {
    return service({
      url: `/api/agent/list?keyWord=${name}&agentType=agent`,
      method: 'get',
    })
  },

  // 商业流向---手工创建产品搜索
  TBUSINESSFLOW_PRODUCT: (id) => {
    return service({
      url: `/api/businessFlow/product/down/list?id=${id}`,
      method: 'get',
    })
  },

  // 商业流向---手工创建产品搜索
  TBUSINESSFLOW_AGENT_PRODUCT: (id,name) => {
    return service({
      url: `/api/agentProduct/product-list?id=${id}&productPopularName=${name}`,
      method: 'get',
    })
  },

  // 商业流向---手工创建终端搜索
  TBUSINESSFLOW_TERMINA: (data) => {
    return service({
      url: `/api/terminal/list-for-business-flow`,
      method: 'post',
      data
    })
  },

   // 商业流向---进货关系接口
   TBUSINESSFLOW_DOWNLIST: (data) => {
    return service({
      url: `/api/businessFlow/terminal/down/list`,
      method: 'post',
      data
    })
  },


  // 商业流向---列表
  TBUSINESSFLOW_LIST: (data) => {
    return service({
      url: `/api/businessFlow/list`,
      method: 'post',
      data
    })
  },

  // 商业流向---详情
  TBUSINESSFLOW_DETAIL: (id) => {
    return service({
      url: `/api/businessFlow/detail?id=${id}`,
      method: 'get',
    })
  },

  // 商业流向---删除
  TBUSINESSFLOW_DELETE: (id) => {
    return service({
      url: `/api/businessFlow/deleteById?id=${id}`,
      method: 'delete',
    })
  },

  // 商业流向---原始/核算列表
  TBUSINESSFLOW_DETAIL_LIST: (data) => {
    return service({
      url: `/api/businessFlow/delivery/direct/list`,
      method: 'post',
      data
    })
  },

  // 商业流向---详提交审批
  TBUSINESSFLOW_SUBMIT: (id) => {
    return service({
      url: `/api/businessFlow/commit/check?id=${id}`,
      method: 'get',
    })
  },

  // 商业流向---编辑
  TBUSINESSFLOW_EDITOR: (data) => {
    return service({
      url: `/api/businessFlow/edit`,
      method: 'put',
      data
    })
  },

})
